
// let {checkLogoutSyncSuccess} = require('./router/bds/sync.js');

WSS.consoleCmd.set('list', {descreption: '显示在线连接', func: ()=>{
    console.log(WSS.clientsManager.getOnlineClientsName());
}});
WSS.consoleCmd.set('playerlist', {descreption: '显示在线玩家', func: ()=>{
    console.log(WSS.clientsManager.getOnlinePlayersName());
}});
WSS.consoleCmd.set('eval', {descreption: '执行代码', func: (args)=>{
    try{
        eval(args.join(" "));
    }catch(e){
        console.error( e );
    }
}});
WSS.consoleCmd.set('setlog', {descreption: '设置日志等级', func: (args)=>{
    let result = WSS.logger.setConsole(true, args[0]);
    if (result){
        console.log(`已设置日志等级为 ${args[0]}`);
    }else{
        console.error(`设置日志等级为 ${args[0]} 失败`);
    }
}});

WSS.consoleCmd.set('debug', {descreption: 'debug模式', func: (args)=>{
    if (CONF.CONFIG.get('Websocket')['Debug']!= true){
        CONF.CONFIG.set('Websocket', {...CONF.CONFIG.get('Websocket'), Debug: true});
        WSS.logger.setConsole(true, 5);
        console.log('WS协调服务端 Debug模式开启');
    }else{
        CONF.CONFIG.set('Websocket', {...CONF.CONFIG.get('Websocket'), Debug: false});
        WSS.logger.setConsole(true, 4);
        console.log('WS协调服务端 Debug模式关闭');
    }
}});


// WSS.consoleCmd.set('checkSyncLogout', {descreption: '检查意外退出未同步状态', func: (args)=>{
//     checkLogoutSyncSuccess();
// }});